package org.insidesource.flexbugs.service;

import java.util.List;

import javax.jws.WebService;

import org.insidesource.flexbugs.dao.IssueDao;
import org.insidesource.flexbugs.model.Issue;

@WebService(name="IssueService", endpointInterface="org.insidesource.flexbugs.service.IssueManager")
public class IssueManagerImpl implements IssueManager
{
	private IssueDao issueDao;
	private CommentManager commentManager;
	
	public IssueManagerImpl()
	{
		
	}
	
	public void setIssueDao(IssueDao issueDao)
	{
		this.issueDao = issueDao;
	}
	
	public void setCommentService(CommentManager commentManager)
	{
		this.commentManager = commentManager;
	}
	
	public Issue get(Long id)
	{
		return issueDao.get(id);
	}

	public List<Issue> getAll()
	{
		return issueDao.getAll();
	}

	public void remove(Long id)
	{
		commentManager.deleteAllCommentsForIssueId(id);
		issueDao.remove(id);
	}

	public void save(Issue issue)
	{
		issueDao.save(issue);
	}

}
